package top.maof.book.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import top.maof.book.model.User;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    int deleteByPrimaryKey(Integer id);

//    int insert(User record);

    int insertSelective(User record);

    User selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    User getWithRole(int id);

    @Select("select id, username, password, nickname, salt, email, phone_number,img from user " +
            "where username = #{username}")
    User selectByUsername(String username);

    @Select("select id, username, password, nickname, salt, email, phone_number,img from user " +
            "where username = #{username} or email = #{email} or phone_number=#{phoneNumber}")
    User selectByUEP(String username, String email, String phoneNumber);
}
